﻿using System;
using System.Collections.Generic;
using ArchPostprocessing.CompoundStructureManage.Utility;
using Autodesk.Revit.DB;
using TopologySearch;

namespace ArchPostprocessing.CompoundStructureManage.DataDefinition
{
	public class RoomEdgeLoopInfo
	{
		public RoomEdgeLoopInfo(RoomEdgeLoopInfo rhs)
		{
			this.m_EdgeLoop = rhs.m_EdgeLoop;
		}

		public RoomEdgeLoopInfo(List<RoomBoundingSegment> edgeLoop)
		{
			this.m_EdgeLoop = edgeLoop;
		}

		public bool IncludeEdge(Pole2D pole, ElementId componentId, double offset)
		{
			foreach (RoomBoundingSegment roomBoundingSegment in this.m_EdgeLoop)
			{
				if (roomBoundingSegment.ComponentId.IntegerValue == componentId.IntegerValue && EdgeInfoCommon.IsOverlap(pole, roomBoundingSegment.Edge, offset))
				{
					return true;
				}
			}
			return false;
		}

		private List<RoomBoundingSegment> m_EdgeLoop = new List<RoomBoundingSegment>();
	}
}
